package com.iwish.server.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateUtil 
{
	/**
	 * 日志文件名称的格式
	 * @return
	 */
	public static String getFullDate()
	{
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss z",Locale.ENGLISH);
		return sdf.format(date);
	}
	
	/**
	 * 存进DB的格式 2011-11-11的字符串格式
	 * @return
	 */
	public static String getYYYYMMDD()
	{
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd",Locale.ENGLISH);
		return sdf.format(date);
	}
	
	/**
	 * 24小时计时方式
	 * @return
	 */
	public static String getHHMMSS()
	{
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss", Locale.ENGLISH);
		return sdf.format(date);
	}
	
	public static void main(String[]args)
	{
		System.out.println(getFullDate());
		System.out.println(getYYYYMMDD());
		System.out.println(getHHMMSS());
	}
}
